WHERE CLAUSE



MySQL - Where Clause


MySQL WHERE clause is used to filter the results from a SELECT, INSERT, UPDATE, or DELETE statement.


The syntax for the WHERE Clause in MySQL is:


SELECT field1, field2,...fieldN table_name1, table_name2...
[WHERE condition1 [AND [OR]] condition2.....

Example - With Single condition :


SELECT *
FROM studentmarks
WHERE Studentmarks = '555';


The result will be displayed as follows:

StudentIdStudentclassStudentmarks
3eighth555

Example - Using AND condition :


SELECT *
FROM studentrecord
WHERE City = 'Hyderabad'
AND PostalCode = 500046;

The result will be displayed as follows:

StudentIdStudentNameParentNameAddressPostalCodeCity
1SanjanajagannathBanjara Hills500046Hyderabad

Example - Using OR condition :


SELECT StudentName
FROM studentinfo
WHERE StudentName = 'Ajaashi'
OR StudentName = 'Sahayana';

The result will be displayed as follows:

StudentName
Ajaashi
Sahayana

Example - Combining AND & OR conditions :


SELECT *
FROM studentrecord
WHERE (ParentName = 'Praveen' AND Address = 'Camel street')
OR (Postalcode = 700096);

The result will be displayed as follows:

StudentIdStudentNameParentNameAddressPostalCodeCity
2ShivanatiniPraveenCamel street700096Kolkata


MySQL TRIGGERS

MySQL - Triggers

posted on 2019-11-29 21:44:07 - mysql Tutorials


Grant_ Revoke Privilege

MySQL - Grant_ Revoke Privilege

posted on 2019-11-26 23:15:04 - mysql Tutorials


MySQL Vs SQL

MySQL Vs SQL

posted on 2019-11-25 05:02:26 - mysql Tutorials


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials